package demo5;

public class Tect {
    public static void animal(Animal animal){
        animal.eat();
        if(animal instanceof Dog){
            Dog dog = (Dog) animal;
            dog.run();
        }else if(animal instanceof Bird){
            Bird bird =(Bird) animal;
            bird.run();
        }else if(animal instanceof Fish){
            Fish fish = (Fish) animal;
            fish.swimming();
        }
    }

    public static void main(String[] args) {
        Bird bird = new Bird();
        Fish fish = new Fish();
        Dog dog = new Dog();
        animal(bird);
        animal(fish);
        animal(dog);
    }
}
